<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>


<style type="text/css">
.addNum {
	bottom:20px;
	right: 10px;
	display: inline-block;
	color: RED;
	font-weight: bold;
	font-size: 18px;
	position: relative;
	float: right;
}

</style>

<div
	style="text-align: center;width:100%;margin:0px auto;height:100px;padding-top:20px;">
	<div
		style="height:90px;width:180px;background-color: #336699; text-decoration: underline;text-align: center;cursor: pointer;margin:0 auto;"
		onclick="openRequestPool()">
		<div> 
		   <span style="color:white;font-size:45px;font-weight: bold;text-decoration: underline;"
			id="taskCount">0</span>
		</div>	
		<div class="addNum" id="addNum_1" style=""></div>
	</div>

</div>

<script type="text/javascript">
	$(function() {
		getUserNewRequestCount();
	});

	function openRequestPool() {
		var url = "incident/main/serviceDeskNewIncidentManage";
		var title = "请求池";
		var options = {
			title : title,
			contentUrl : url
		};
		isperp.openDialog(options);
	}

	setInterval(getUserNewRequestCount, 1000 * 30);

	function getUserNewRequestCount() {
		$.ajax({
			url : 'app/portal/main/getUserNewRequestCount',
			data : {},
			success : function(data) {
				var initCount = $("#taskCount").text();
				if (initCount == "0") {
					$("#taskCount").text(data);
				} else {
					var nowCount = parseInt(data);
					var addCount = nowCount - parseInt(initCount);
					if(addCount>0)
					{
					   addNum(addCount);
					}
					
				}
			}
		});
	}

	function addNum(num) {
		var now = parseInt($("#taskCount").text());
		$("#addNum_1").html("+" + num);
		$("#addNum_1").fadeIn(100).fadeOut(2500);
		$("#taskCount").text(now + num);

	}
</script>

